﻿using EFCore.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SService;

namespace WMSWeb.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PurchasedetailsController : ControllerBase
    {
        private readonly WmssystemContext myDb;
        private readonly PurchasedetailsS purchasedetails;

        public PurchasedetailsController(WmssystemContext myDb, SService.PurchasedetailsS purchasedetails)
        {
            this.myDb = myDb;
            this.purchasedetails = purchasedetails;
        }
        /// <summary>
        /// 进货查询全部
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpGet]
        public async Task<List<PO_Purchasedetails>> Qu(string dh)
        {
            return await purchasedetails.Qu(dh);
        }
        /// <summary>
        /// 进货明细添加
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPost]
        public async Task<int> Add(PO_Purchasedetails pO_Purchasedetails)
        {
            return await purchasedetails.Add(pO_Purchasedetails);
        }
        /// <summary>
        /// 进货明细删除
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpDelete]
        public async Task<int> Del(int id) 
        {
           return await purchasedetails.Del(id);
        }
        /// <summary>
        /// 进货明细批量修改
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> Upd(Vawewe vawewe)
        {
            return await purchasedetails.Upd1(vawewe);
        }
    }
}
